﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Student
    {
        public Student(string name,int age,char sex)
        {
            this.Nmae = name;
            this.Age = age;
            this.Sex = sex;
        }

        private string _name;
        public string Nmae
        {
            get { return _name; }
            set { _name = value; }
        }
        private int _age;
        public int Age
        {
            get { return _age; }
            set {
                if (value>100||value<0)
                {
                    _age = 0;
                }
                _age = value; }
        }
        private char _sex;
        public char Sex
        {
            get
            {
                if (_sex!='男'&&_sex!='女')
                {
                    return _sex = '男';
                }
                return _sex;
            }
            set
            {
               
                _sex = value;
            }

        }
         public void Speak() {
            Console.WriteLine("吾名为{0}，吾今年{1}岁，吾为{2}性。",this._name,this._age,this._sex);
        }

      
        abstract class Myabs
        {

        }
        sealed class MySea    
        {

        }
    }
    
}
